#import "SettingsDatabase.h"
#import "TrackFilepath.h"

@implementation TrackFilepath

@synthesize trackScanDirectoryID, filepathRelativeToScanDirectory;

-(id)initWithTrackScanDirectoryID:(unsigned int)i filepathRelativeToScanDir:(NSString*)path {
	if ((self = [super init]) != nil) {
		self.trackScanDirectoryID = i;
		self.filepathRelativeToScanDirectory = path;
	}
	return self;
}

+(TrackFilepath*)trackFilepathWithTrackScanDirectoryID:(unsigned int)i filepathRelativeToScanDir:(NSString*)path {
	TrackFilepath *trackFilepath = [[TrackFilepath alloc] initWithTrackScanDirectoryID:i filepathRelativeToScanDir:path];
	return [trackFilepath autorelease];
}

-(NSString*)getCompleteFilePath {
	NSArray *trackScanningDirs = [[SettingsDatabase sharedSettingsDatabase] trackScanningDirectories];
	return [[trackScanningDirs objectAtIndex:trackScanDirectoryID] stringByAppendingString:filepathRelativeToScanDirectory];
}

- (void)dealloc {
    trackScanDirectoryID = NULL;
	[filepathRelativeToScanDirectory release];
    [super dealloc];
}
@end
